using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.IO;

namespace GPSCore.GPX
{
    /// <summary>
    /// GPX File Manager
    /// </summary>
    public class GPXManager
    {
        #region members

        /// <summary>
        /// the GPX Object Type...
        /// </summary>
        private XmlSerializer _xser = new XmlSerializer(typeof(GPSCore.GPX.gpxType));

        private FileStream _fstr;

        private gpxType _gpx;

        #endregion

        #region constructors

        /// <summary>
        /// GPXManager Constructor
        /// </summary>
        public GPXManager()
        { }

        /// <summary>
        /// GPXManager Open From File
        /// </summary>
        /// <param name="FilePath"></param>
        public GPXManager(string FilePath)
        {
            _fstr = new FileStream(FilePath, FileMode.Open);

            _gpx = (gpxType)_xser.Deserialize(_fstr);
        }

        /// <summary>
        /// GPXManager from Xml
        /// </summary>
        /// <param name="XmlR"></param>
        public GPXManager(XmlReader XmlR)
        {
            _gpx = (gpxType)_xser.Deserialize(XmlR);
        }

        #endregion

        #region methods


        #endregion

        #region properties
        
        /// <summary>
        /// Gpx Raw Object
        /// </summary>
        public gpxType RawGpxData
        {
            get { return _gpx; }
        }

        #endregion

    }
}
